package com.animation;

import android.annotation.TargetApi;
import android.app.Activity;
import android.app.PictureInPictureParams;
import android.graphics.Color;
import android.graphics.PixelFormat;
import android.os.Build;
import android.os.Bundle;
import android.util.Rational;
import android.view.Surface;
import android.view.SurfaceView;
import android.view.View;
import android.view.WindowManager;
import android.widget.LinearLayout;

import com.badlogic.gdx.backends.android.AndroidApplication;
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;

public class AndroidLauncher extends AndroidApplication {
	@TargetApi(Build.VERSION_CODES.O)
	@Override
	protected void onCreate (Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON| WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD| WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED| WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
		AndroidApplicationConfiguration configure=new AndroidApplicationConfiguration();
		configure.hideStatusBar=false;
		SurfaceView view = (SurfaceView) initializeForView(new Animation(), configure);


		setContentView(R.layout.activity_main);

		LinearLayout ll = findViewById(R.id.gameview);
		view.getHolder().setFormat(PixelFormat.TRANSLUCENT);
		ll.addView(view);
		PictureInPictureParams.Builder builder = new PictureInPictureParams.Builder();
		builder.setAspectRatio(new Rational(1,1));
		enterPictureInPictureMode(builder.build());
	}
}
